import logging
import time
logger = logging.getLogger('sc')
logger.setLevel(logging.INFO)
sh = logging.StreamHandler()
fh = logging.FileHandler('sc.log')
sh.setLevel(logging.INFO)
fh.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s —— %(message)s')
sh.setFormatter(formatter)
fh.setFormatter(formatter)
logger.addHandler(sh)
logger.addHandler(fh)
def FuncName(func):
    def inner(*args,**kwargs):
        start = time.time()
        redata = func(*args,**kwargs)
        logger.info('Execute: {0} Runtime: {1}'.format(func.__name__,time.time() - start))
        return redata
    return inner
# @FuncName
# def OneSecond(n):
#     time.sleep(n)
#     print("sleeping : {0} seconds".format(n))
# @FuncName
# def add(a,b):
#     print(a + b)
# @FuncName
# def waste():
#     print("waste")
# OneSecond(1)
# add(3,5)
# waste()